Skip to content

[DSL] fixes for GFDL_1M microphysics#1394

Draft
romanc wants to merge 11 commits intoGEOS-ESM:developfrom
romanc:dsl/fix/microphysics
Draft

[DSL] fixes for GFDL_1M microphysics#1394
romanc wants to merge 11 commits intoGEOS-ESM:developfrom
romanc:dsl/fix/microphysics

Conversation

@romanc
Copy link
Copy Markdown
Contributor

@romanc romanc commented May 6, 2026

Description

Work in progress to stabilize GFDL_1M microphysics. With this state, I get

image

with the data downloaded from here.

Labelled as 0-diff because this only touches the DSL part - no changes to the Fortran.

@romanc romanc added the 0 diff The changes in this pull request have verified to be zero-diff with the target branch. label May 6, 2026
Copy link
Copy Markdown
Contributor Author

@romanc romanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some notes inline

from __externals__ import CCW_EVAP_EFF, DT_MOIST

with computation(PARALLEL), interval(...):
evaporation = mixing_ratio_vapor
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evaporation is written unconditionally below again (and not read in between) - so this line is unnecessary

qc_i = mixing_ratio_large_scale_ice * inv_clcn
t_n = t
qs_x, _ = saturation_specific_humidity(t=t, p=p_mb * 100, ese=ese, esx=esx)
qs_x, _ = saturation_specific_humidity(t=t, p=p_mb * 100.0, ese=ese, esx=esx)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are the pressure fields that are floats and thus need to be multiplied with a float

convective_ice=state.mixing_ratio.convective_ice,
mixing_ratio_vapor=state.mixing_ratio.vapor,
mixing_ratio_convective_liquid=state.mixing_ratio.convective_liquid,
mixing_ratio_convective_ice=state.mixing_ratio.convective_ice,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those were the things needed to just run (in stencil mode)

surface_type=state.surface_type,
t=state.t,
liquid=state.mixing_ratio.large_scale_liquid,
ice=state.mixing_ratio.large_scale_ice,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somehow this stencil was running twice ...

@romanc romanc force-pushed the dsl/fix/microphysics branch 9 times, most recently from 39c4524 to 700bfec Compare May 7, 2026 07:37
@romanc romanc force-pushed the dsl/fix/microphysics branch 2 times, most recently from 0c2b4d3 to 048465d Compare May 7, 2026 07:44
- change workflow to run on pull requests
- change paths to include changes to the workflow
- change python version to 3.12 (as on the HPC)
- fix `mkdocs build`
- fix data url
- make wget less verbose
- fix `pytest` invocation
- add NDSL to dependencies
- non-verbose `tar` extract
- pick a (random) experiment (why is this needed?!)
- fix `test_constants` by adding more excludes
- fix running translate test by temporarily exluding netCDFs that
  don't match a translate test anymore.
@romanc romanc force-pushed the dsl/fix/microphysics branch from 048465d to 4f2d98b Compare May 7, 2026 08:55
romanc added 5 commits May 7, 2026 15:13
This commit changes `saturation_specific_humidy()` such that the case of
`use_ramp=True` is rejected as not implemented. So far, we don't have a
use-case for this case. Doing so allows us to avoid a floating point
comparison with plain `==`, which is dagerous.
uramp = -abs(ramp)
else:
uramp = TMIX
raise NotImplementedError("The option `use_ramp=True` is not implemented.")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, this serves as a stop-gap measure to avoid the float equality check below. We can revisit once we have a need for the ramp / use_ramp arguments.

romanc added 4 commits May 8, 2026 14:42
Since we are depending on a couple of recent changes in NDSL and
since we not planning to release any time soon, let's just use
`ndsl @ develop` for now.
We can't `raise NotImplementedError` from within a `gtscript.function`.
Since we never use the `ramp` option, let's remove it all together. This
also removes the need to supply the `ese` table, which trickles in a lot
of places ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0 diff The changes in this pull request have verified to be zero-diff with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant